﻿using System;
using System.Linq.Expressions;
using Domain.Core.Specification;
using Domain.MainModule.Entities;

namespace Domain.MainModule.CustomerServices
{
    public class CustomerServiceOrderIdSpecification : Specification<CustomerService>
    {
        #region public properties

        public Guid OrderId
        {
            get;
            set;
        }

        #endregion

        #region constructor

        public CustomerServiceOrderIdSpecification(Guid orderId)
        {
            this.OrderId = orderId;
        }

        #endregion

        #region public methods

        public override Expression<Func<CustomerService, bool>> SatisfiedBy()
        {
            Specification<CustomerService> spec = new TrueSpecification<CustomerService>();
            spec &= new DirectSpecification<CustomerService>(c => c.OrderId == this.OrderId);

            return spec.SatisfiedBy();
        }

        #endregion
    }
}
